module.exports = {
  /*
  ** Headers of the page
  */
  head: {
    title: 'user-site',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '用户操作平台' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/yi.png' }
    ]
  },
  /*
  ** Customize the progress bar color
  */
  loading: { color: '#3B8070' },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** Run ESLint on save
    */
    extend (config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  },
  plugins: [
    { src: '~plugins/myPlugin.js', ssr: false },
    // 设置 这个插件就是在客户端渲染时，才会触发
    { src: '~/plugins/axios', mode: 'client' }
  ],
  modules: [
    '@nuxtjs/axios'
  ],
  /* 需要使用 aixos必须配置以下两项axios和proxy*/
  axios: {
    prefix: '/api/',
    proxy: true,
    credentials: true,
  },

  proxy: {
    '/api/': {
      target: 'http://localhost',
      pathRewrite: {
        '^/api/': '/',
        changeOrigin: true
      }
    }
  },
}

